#include <stdio.h>
#include <math.h>
#include <omp.h>

int main(int argc, char *argv[]) {

    int i,j,k,l,aflag,limit,prod;
    double temp;

    if (argc<2) 
        return 0;

    limit = atoi(argv[1]);

    for (i=1;i<=limit;i++) {
        aflag=0;
        for (j=i;j>=-i;j--) {
            if (j==0) continue;
            for (k=i/j;k>=-i/j;k--) {
		        if (k==0) continue;
                for (l=i/(j*k);l<=-i/(j*k);l++) {
			        prod = j*k*l;
			        if (prod==i) {
                        temp=(1/(double)j)+(1/(double)k)+(1/(double)l);
                        if (fabs(temp-(1/(double)i))<1e-9) aflag=1;
			        }
                }
            }
        }

        if (aflag) printf("%d\n",i);
    }
}


